package com.stary.code.springboot.config;

import java.util.Map;

import com.stary.code.springboot.rules.WebViewType;

public class SpringBootProjectConfig {
	/**
	 * springboot版本，默认1.5.19
	 */
	private String springBootVersion="1.5.19";
	/**
	 * java版本，默认1.7
	 */
	private String javaVersion="1.7";
	/**
	 * 是否开启视图，默认false
	 */
	private boolean openView=false;
	/**
	 * 是否开启数据源，默认false
	 */
	private boolean openDataSource=false;
	/**
	 * 是否开启自定义logback，默认true
	 */
	private boolean openLogback=true;
	/**
	 * web视图类型，默认 thymeleaf
	 */
	private String viewType=WebViewType.THYMELEAF.getName();
	/**
	 * 需要的依赖
	 */
	private  Map<String, String> dependencyMap;
	/**
	 * 是否生成表结构文档，默认false
	 */
	private boolean tableDocCreated=false;
	
	public String getSpringBootVersion() {
		if(springBootVersion!=null && !springBootVersion.contains(".RELEASE")){
			springBootVersion+=".RELEASE";
		}
		return springBootVersion;
	}
	public void setSpringBootVersion(String springBootVersion) {
		this.springBootVersion = springBootVersion;
	}
	public String getJavaVersion() {
		if("1".equals(getSpringBootVersion().substring(0,1))){
			javaVersion="1.7";
		}
		return javaVersion;
	}
	public void setJavaVersion(String javaVersion) {
		this.javaVersion = javaVersion;
	}
	public boolean isOpenView() {
		return openView;
	}
	public void setOpenView(boolean openView) {
		this.openView = openView;
	}
	
	public boolean isOpenDataSource() {
		if(!openDataSource){
			tableDocCreated=false;
		}
		return openDataSource;
	}
	public void setOpenDataSource(boolean openDataSource) {
		this.openDataSource = openDataSource;
	}
	public String getViewType() {
		return viewType;
	}
	public void setViewType(String viewType) {
		this.viewType = viewType;
	}
	public Map<String, String> getDependencyMap() {
		return dependencyMap;
	}
	public void setDependencyMap(Map<String, String> dependencyMap) {
		this.dependencyMap = dependencyMap;
	}
	public boolean isOpenLogback() {
		return openLogback;
	}
	public void setOpenLogback(boolean openLogback) {
		this.openLogback = openLogback;
	}
	public boolean isTableDocCreated() {
		return tableDocCreated;
	}
	public void setTableDocCreated(boolean tableDocCreated) {
		this.tableDocCreated = tableDocCreated;
	}
	
}
